'use strict'
const dotenv = require('dotenv')
const path = require('path')
const pkg = require('../../package.json')
const constants = require('../utils/constants')

dotenv.config({
  path: path.resolve(__dirname, '../../.env') // load .env
})

process.env.NODE_ENV = process.env.NODE_ENV || constants.ENV_DEV // dev, prod, test

const env = process.env.NODE_ENV

module.exports = {
  name: pkg.name,
  port: +process.env.PORT || 4000,
  env,
  dbconfig: {
    connectionLimit: +process.env.DB_CONNECT_LIMIT || 10,
    host: process.env.DB_HOST || '127.0.0.1',
    port: process.env.DB_PORT || 3306,
    user: process.env.DB_USER || 'root',
    password: process.env.DB_PASS || '123456',
    database: process.env.DB_NAME || 'test',
    charset: process.env.DB_CHARSET || 'utf8mb4_general_ci',
    wait_timeout: 20000
  }
}
